using System.Text;
using UnityEngine;
#if UNITY_EDITOR
using UnityEditor;
#endif

public enum ItemType
{
    None,
    Equipment,
    Consumable,
    Material,
    QuestItem
}

[CreateAssetMenu(fileName = "New Item Data", menuName = "Data/Item", order = 1)]
public class ItemData : ScriptableObject
{
    public ItemType ItemType;
    public string ItemName;
    public Sprite ItemIcon;
    public string itemId;
    [Range(0, 100)]
    public float DropChance;
    protected StringBuilder sb = new StringBuilder();

#if UNITY_EDITOR
    private void OnValidate()
    {
        string path = AssetDatabase.GetAssetPath(this);
        itemId = AssetDatabase.AssetPathToGUID(path);
    }
#endif

    public virtual string GetDescription()
    {
        _ = sb.Clear();
        _ = sb.AppendLine($"Name: {ItemName}");
        _ = sb.AppendLine($"Type: {ItemType}");
        _ = sb.AppendLine($"Drop Chance: {DropChance}%");
        return sb.ToString();
    }
    // public string itemDescription;
    // public int itemID;
    // public int itemValue;

    // Add any additional properties or methods as needed
}